import { request } from '../../request/index.js';
Page({

  data: {
    //轮播图数组
    swiperList: [],
    //导航数组
    catesList: [],
    //楼层数组
    floorList: [],
    //分隔字符串
    denghao: ''



  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getSwiperList()
    this.getCateList()
    this.getFloorList()

  },

  //获取轮播图数据
  async getSwiperList () {
    const res = await request({ url: "/home/swiperdata" })
    this.setData({
      swiperList: res.data.message
    })
  },
  //获取导航数据
  async getCateList () {
    const res = await request({ url: "/home/catitems" })
    this.setData({
      catesList: res.data.message
    })

  },

  //获取楼层数据
  async getFloorList () {
    const res = await request({ url: "/home/floordata" })
    var data = JSON.stringify(res.data.message);
    var data1 = data.replace(/goods_list/g, 'goods_list/index')
    var data2 = JSON.parse(data1)

    this.setData({
      floorList: data2
    })

  },



})